<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改商品价格')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-goods-edit" th:object="${shopGoods}">
        <input name="id" th:field="*{id}" type="hidden">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label is-required">商品类别：</label>
                <div class="col-sm-8">
                        <input id="treeId" name="goodsTypeId" type="hidden" th:field="*{goodsTypeId}">
                        <input class="form-control" type="text" onclick="selectGoodsTypeTree()" id="treeName" th:value="${shopGoodsType.goodsTypeName}" readonly="true" required>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label is-required">商品编码：</label>
                <div class="col-sm-8">
                    <input name="goodsCode" th:field="*{goodsCode}" class="form-control" type="text" maxlength="16" required readonly>
                </div>
            </div>
        </div>

        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label is-required">商品名称：</label>
                <div class="col-sm-8">
                    <input name="goodsName" th:field="*{goodsName}" class="form-control" type="text" maxlength="30" required readonly>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label">商品条码：</label>
                <div class="col-sm-8">
                    <input name="goodsBarcode" th:field="*{goodsBarcode}" class="form-control" type="text" maxlength="30" readonly>
                </div>
            </div>
        </div>

        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label">商品重量：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                    <input name="goodsWeight" th:field="*{goodsWeight}" class="form-control" type="text" maxlength="16">
                        <span class="input-group-addon">(千克)</span>
                    </div>

                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label">成本价：</label>
                <div class="col-sm-8">
                    <input name="costPrice" th:field="*{costPrice}" class="form-control" type="text" maxlength="16" th:readonly="${shopGoods.isCost} eq 'Y'" >
                </div>
            </div>
        </div>

        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label is-required">零售价：</label>
                <div class="col-sm-8">
                    <input name="retailPrice" th:field="*{retailPrice}" class="form-control" type="text" maxlength="16" required>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label is-required">销售价：</label>
                <div class="col-sm-8">
                    <input name="sellingPrice" th:field="*{sellingPrice}" class="form-control" type="text" maxlength="16" required>
                </div>
            </div>
        </div>

        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label is-required">批发价：</label>
                <div class="col-sm-8">
                    <input name="wholesalePrice" th:field="*{wholesalePrice}" class="form-control" type="text" maxlength="16" required>
                </div>
            </div>
        </div>

    </form>
</div>


<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "shop/goods";
    $("#form-goods-edit").validate({
        onkeyup: false,
        rules:{
            costPrice:{ number:true,min:0 },
            retailPrice:{ number:true,min:0 },
            sellingPrice:{ number:true,min:0 },
            wholesalePrice:{ number:true,min:0 },
            safetyStock:{ digits:true, },
        },
        messages: {
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/editSavePrice", $('#form-goods-edit').serialize());
        }
    }

</script>
</body>
</html>